<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DNA双螺旋</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            width: 100vw;
            height: 100vh;
            background-color: #000;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
        }
        /* BEM */
        .box-dna{
            width: 100vw;
            height: 200px;
            display: flex;
            flex-direction: row;
            justify-content: center;
            transform-style: preserve-3d;
            transform: rotate(30deg);
        }
        .box-dna__container{
            perspective: 700px;
            display: flex;
            flex-direction: row;
            justify-content: center;
        }
        .box-dna__item{
            width: 1px;
            height: 200px;
            background-color: cornflowerblue;
            position: relative;
            transform: rotateY(0deg);
            margin-right: 10px;
            animation: dnaRoate 5s linear infinite;
        }
        .box-dna__item::after, .box-dna__item::before{
            content: '';
            display: block;
            position: absolute;
            border-radius: 50%;
            width: 10px; height: 10px;
            background-color: cornflowerblue;
            top: 0; left: -5px;
        }
        .box-dna__item::before{
            top: auto;
            bottom: 0;
        }
        @keyframes dnaRoate {
            0%{
                transform: rotateX(0deg);
            }
            100%{
                transform: rotateX(360deg);
            }
        }
    </style>
</head>
<body>
    <div class="box-dna">
        <div class="box-dna__container">
        </div>
    </div>
    <script>
        let s = '';
        let count = 90;
        let box = document.querySelector('.box-dna__container');
        let diff = 0.05;
        for (let i = 0; i < 90; i++) {
            const style = `style="animation-delay: -${(90 - i) * diff}s;"`
            s += `<div class="box-dna__item" ${style} ></div>`;
        }
        box.innerHTML = s
    </script>
</body>
</html>
